package com.chenqi.tool.databinding

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.databinding.ViewDataBinding
import androidx.fragment.app.Fragment
import com.chenqi.tool.databinding.BaseViewBinding
import com.chenqi.tool.databinding.getViewBinding

/**
 * 作者: CQ
 * 日期: 2021-06-01
 * 说明: DataBinding之fragment
 */
abstract class DataBindingFragment<VB : ViewDataBinding> : Fragment(), BaseViewBinding<VB> {
    lateinit var mBinding: VB

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        mBinding = getViewBinding(inflater, container)
        return mBinding.root
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        mBinding.initBinding()
    }

}